package LCD;

//package LCD;

import java.util.Scanner;

public class Main {
    private static long tiempoInicial=System.currentTimeMillis();

    private static boolean numeroLCD[][] = {
        {true, true, true, true, true, true, false},
        {false, true, true, false, false, false, false},
        {true, true, false, true, true, false, true},
        {true, true, true, true, false, false, true},
        {false, true, true, false, false, true, true},
        {true, false, true, true, false, true, true},
        {true, false, true, true, true, true, true},
        {true, true, true, false, false, false, false},
        {true, true, true, true, true, true, true},
        {true, true, true, true, false, true, true}};

    private static Scanner s = new Scanner(System.in);
    private static int tamanio = 0;
    private static int numero[];
    private static char numeroAux[];

    public static void main(String args[]) {
        double p = Math.PI;
        while (s.hasNextLine()) {
            tamanio = Integer.parseInt(s.next());
            if (tamanio != 0) {
                numeroAux = s.next().toCharArray();
                numero = new int[numeroAux.length];
                for (int i = 0; i < numeroAux.length; i++) {
                    numero[i] = Integer.parseInt("" + numeroAux[i]);
                }

                imprimirHorizontal(0);

                for (int i = 0; i < tamanio; i++) {
                    imprimirVertical(5, 1);
                }

                imprimirHorizontal(6);

                for (int i = 0; i < tamanio; i++) {
                    imprimirVertical(4, 2);
                }

                imprimirHorizontal(3);
            } else {
                System.out.println(System.currentTimeMillis() - tiempoInicial);
                System.exit(0);
            }
        }
    }

    private static void imprimirHorizontal(int rayita) {


        for (int i = 0; i < numero.length; i++) {
            System.out.print(" ");
            for (int j = 0; j < tamanio; j++) {
                if (numeroLCD[numero[i]][rayita]) {
                    System.out.print("-");
                } else {
                    System.out.print(" ");
                }
            }
            System.out.print(" ");

            if (i + 1 != numero.length) {
                System.out.print(" ");

            } else {
                System.out.print("\n");
            }
        }
    }

    private static void imprimirVertical(int rayitaIzquierda, int rayitaDerecha) {
        for (int i = 0; i < numero.length; i++) {

            if (numeroLCD[numero[i]][rayitaIzquierda]) {
                System.out.print("|");
            } else {
                System.out.print(" ");
            }

            for (int j = 0; j < tamanio; j++) {
                System.out.print(" ");
            }

            if (numeroLCD[numero[i]][rayitaDerecha]) {
                System.out.print("|");
            } else {
                System.out.print(" ");
            }

            if (i + 1 != numero.length) {
                System.out.print(" ");
            } else {
                System.out.print("\n");
            }
        }
    }
}
